import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'

import './assets/css/global.css'
import './assets/fonts/iconfont.css'

import ZkTable from 'vue-table-with-tree-grid'

import axios from 'axios'
Vue.component('tree-table', ZkTable)
import utils from './libs/utils'

import VueQuillEditor from 'vue-quill-editor'

import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme

Vue.use(VueQuillEditor)

import nprogress from 'nprogress'
import 'nprogress/nprogress.css'

// axios.defaults.baseURL = 'http://ssw.fit:8887/api/v1/'
// axios.defaults.baseURL = 'http://127.0.0.1:8887/api/v1/'
axios.defaults.baseURL = 'http://192.168.19.194:8887/api/v1/'
axios.defaults.withCredentials = true
axios.interceptors.request.use(config => {
  nprogress.start()
  console.log('config', config)
  const userInfo = JSON.parse(sessionStorage.getItem('userInfo'))
  console.log('userInfo xxx', userInfo)
  config.headers.Authorization = userInfo?userInfo.token:''
  return config
})
axios.interceptors.response.use(config => {
  nprogress.done()
  return config
})
Vue.prototype.$http = axios
Vue.prototype.$utils = utils

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
